"""
comparison.py

Compare Jonas 1993 cell with Schmidt-Hieber 2007
"""

from neuron import h
from CA3.library import jonas1993

# global variables
tstop =  10
Vrest = -70

jonas = jonas1993()

# create VClamps on cells
jonas_vclamp = h.SEClamp(0.5, sec = jonas.soma)

# fill same VClamp parameters for both
jonas_vclamp.rs = 0.1
jonas_vclamp.amp1 = Vrest 
jonas_vclamp.dur1 = tstop

# set one synapse originally at the soma
jonas_syn = h.synapse(0.5, sec = jonas.soma)
jonas_syn.tonset = 0 
jonas_syn.tau0 = 0.2 # in ms (tau onset in Jonas et al., 1993)
jonas_syn.tau1 = 2.5 # in ms (tau decay in Jonas et al., 1993)
jonas_syn.gmax = 300e-6 # 300 pS in Jonas et al., 1993

# run simulation

# init 
h.load_file('stdrun.hoc')
h.v_init = Vrest 
h.tstop = tstop
jonas.set_Vrest(Vrest)

current, time = h.Vector(), h.Vector()

current.record(jonas_syn._ref_i, sec=jonas.soma)
time.record(h._ref_t, sec=jonas.soma)

h.run() # run simulation
mygraph = h.Graph()
mygraph.size(0, 10, 0.001, -0.021)
current.line(mygraph, time)
h.run() # run simulation


